package mqueuex

type IntegralTask interface {
	reward()
	revoke()
}

// 满 N 元任务
type OrderFullAmountTask struct {
	orderInfo struct {
		Amount int64
	}
	fullAmount int64
	integral   int
}

func (t *OrderFullAmountTask) isFullAmount() bool {
	if t.orderInfo.Amount >= t.fullAmount {
		return true
	}

	return false
}

func (t *OrderFullAmountTask) reward() int {
	if t.isFullAmount() {
		return t.integral
	}

	return 0
}

func (t *OrderFullAmountTask) revoke() int {
	if t.isFullAmount() {
		return t.integral
	}

	return 0
}

type OrderDailyTask struct {
	integral int
}

func (t *OrderDailyTask) isTodayFirst() bool {
	return false
}

func (t *OrderDailyTask) reward() int {
	if t.isTodayFirst() {
		return t.integral
	}

	return 0
}

func (t *OrderDailyTask) revoke() int {
	if t.isTodayFirst() {
		return t.integral
	}

	return 0
}

type SignInTask struct {
	integral int
}

func (t *SignInTask) todayIsSignIn() bool {
	return false
}

func (t *SignInTask) reward() int {
	if t.todayIsSignIn() {
		return t.integral
	}

	return 0
}

func (t *SignInTask) revoke() int {
	if t.todayIsSignIn() {
		return t.integral
	}

	return 0
}
